<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>诊辅系统-后台管理</title>
    <link rel="stylesheet" href="/js/bootstrap/bootstrap-v4.3.1.min.css">
    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" href="/css/admin.css">
    <link rel="stylesheet" type="text/css" href="/js/bootstrap/datepicker/bootstrap-datetimepicker.min.css">
</head>

<body>
<nav class="navbar navbar-light" style="background-color: #3498db;">
    <a class="navbar-brand" href="#">诊辅系统-后台管理</a>
    <div class="collapse navbar-collapse" id="navbarNav" style="float: right">
      <ul class="navbar-nav">
        <li class="nav-item active">
          <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Features</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Pricing</a>
        </li>
        <li class="nav-item">
          <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
        </li>
      </ul>
    </div>
    <div class="form-inline my-2 my-lg-0" id="userBox" style="margin-right: 2rem">
        <ul>
            <li class="dropdown  nav-item" style="cursor:pointer;">
                <a class="nav-link" id="header-userDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <span class="glyphicon glyphicon-user adminName">
                             <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>Loading...
                        </span>
                    <span class="caret"></span>
                </a>
                <div class="dropdown-menu" aria-labelledby="userDropdown">
                    <a class="dropdown-item" id="admin-loginOut" href="javascript:;">退出</a>
                </div>
            </li>
            <li><a id="update" class="nav-link" style="cursor:pointer;">刷新</a></li>
            <li><a class="nav-link" style="cursor:pointer;">使用说明</a></li>
        </ul>
    </div>
</nav>
<div class="">
    <nav class="container" style="margin-top: 3rem;font-size: 21px;">
        <div class="nav nav-tabs" id="nav-tab" role="tablist">
            <a class="nav-item nav-link  active" id="showData-tab" data-toggle="tab" href="#showData"
               role="tab" aria-controls="reservationsClass" aria-selected="true">数据展示</a>
            <a class="nav-item nav-link " id="userData-tab" data-toggle="tab" href="#userData"
               role="tab" aria-controls="userData" aria-selected="false">用户管理</a>
            <a class="nav-item nav-link " id="courseTypeBox-tab" data-toggle="tab"
               href="#courseTypeBox"
               role="tab" aria-controls="courseTypeBox" aria-selected="false">课程类别管理</a>
        </div>
    </nav>
    <div class="tab-content " id="nav-tabContent">
        <div class="tab-pane fade  p-2 show active" id="showData" role="tabpanel"
             aria-labelledby="showData-tab">
            <div class="row" id="top-show-box">
                <div class="col-md-6">
                    <div class=" border jumbotron show-box row " id="number-show-box" style="padding-right: 0;padding-left: 0">
                        <div class="col-md-7">
                            <div class="title">
                                <h3>过去7天课程类别占比情况</h3>
                            </div>
                            <hr class="my-4">
                            <div class="content" id="courses-show-box-container">
                            </div>
                        </div>
                        <div class="col-md-5" style="padding-top: 2rem;">
                            <div id="show-pie-chart"
                                 style="height: 330px;width: 100%;  text-align: center;"></div>
                        </div>
                    </div>

                </div>
                <div class="col-md-6">
                    <div class=" border jumbotron show-box row " id="future-box">
                        <div class="col-md-12">
                            <div class="title">
                                <h3>未来30天课程发布情况</h3>
                            </div>
                            <hr class="my-4">
                            <div class="content" >
                                <table class="table text-center table-set">
                                    <thead>
                                    <tr>
                                        <th >序号</th>
                                        <th >时间</th>
                                        <th >类别</th>
                                        <th >老师</th>
                                        <th >状态</th>
                                        <th >详细</th>
                                    </tr>
                                    </thead>
                                    <tbody id="show-issue-box-container"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="container border jumbotron show-box" id="show-data-box">
                <div class="title">
                    <h3>过去一个月课程发布情况</h3>
                </div>
                <hr class="my-4">
                <div class="row">
                    <div class="content col-md-6" id="show-data-content" style="width: 100%;height:400px;">
                    </div>
                    <div class="col-md-6">
                        <table class="table text-center table-set">
                            <thead>
                            <tr>
                                <th style="width: 100px">序号</th>
                                <th style="width: 160px">时间</th>
                                <th style="width: 100px">类别</th>
                                <th style="width: 90px">老师</th>
                                <th style="width: 100px">详细</th>
                            </tr>
                            </thead>
                            <tbody id="show-history-box-container"></tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="tab-pane fade  p-2 show container " id="userData" role="tabpanel"
             aria-labelledby="userData-tab">
                <div class="row">
                    <div class="col-md-12">
                        <div class=" border jumbotron show-box " style="max-height: 600px;;" id="stu-msg-list">
                             <div class="title">
                                <h3>学生用户信息列表</h3>
                            </div>
                                <hr class="my-4">
                            <div>
                                <table class="table text-center table-set">
                                    <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>ID</th>
                                            <th>NBR</th>
                                            <th>姓名</th>
                                            <th>性别</th>
                                            <th>电话</th>
                                            <th>更新时间</th>
                                            <th>编辑</th>
                                        </tr>
                                    </thead>
                                    <tbody id="show-stu-list-container"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class=" border jumbotron show-box " style="max-height: 600px;;" id="tea-msg-list">
                            <div class="title">
                                <h3>教师用户信息列表</h3>
                            </div>
                            <hr class="my-4">
                            <div>
                                <table class="table text-center table-set">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>ID</th>
                                        <th>NBR</th>
                                        <th>姓名</th>
                                        <th>性别</th>
                                        <th>电话</th>
                                        <th>更新时间</th>
                                        <th>编辑</th>
                                    </tr>
                                    </thead>
                                    <tbody id="show-tea-list-container"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                    <div class=" border jumbotron show-box " style="max-height: 600px;;" id="reset-msg-list">
                        <div class="title">
                            <h3>申请重置密码用户</h3>
                        </div>
                        <hr class="my-4">
                        <div>
                            <table class="table text-center table-set">
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>申请流水ID</th>
                                    <th>申请重置用户NBR</th>
                                    <th>用户姓名</th>
                                    <th>用户电话</th>
                                    <th>申请详细信息</th>
                                    <th>状态</th>
                                    <th>处理</th>
                                </tr>
                                </thead>
                                <tbody id="show-reset-list-container"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
                    <div class="col-md-12">
                        <div class=" border jumbotron show-box " id="input-user-msg">
                            <div class="title">
                                <h3>用户信息导入</h3>
                            </div>
                            <hr class="my-4">
                            <div class="row" id="input-select-box">
                                <div class="col-md-6">
                                    <a class="btn btn-primary" id="input-once">手动导入单个用户</a>
                                </div>
                                <div class="col-md-6">
                                    <a class="btn btn-primary" id="input-batch">批量导入多个用户</a>
                                </div>
                            </div>
                            <div id="back-select-box" style="display: none;height: 2rem;">
                                <p>
                                    <a id="back-select-btn" href="javascript:;" style="float: right;">返回导入选项 →</a>
                                </p>
                            </div>
                            <div id="upload-box" style="display: none">
                                <div class="row">
                                    <div class="col-md-4">
                                        <a href="/dtr/user-file/download">👉模板下载</a>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="sr-only" for="userFile">文件输入</label>
                                        <input type="file" id="userFile" name="userFile">
                                    </div>
                                    <div class="col-md-2">
                                        <button id="upload-btn" class="btn btn-primary">提交</button>
                                    </div>
                                </div>
                                <div class="progress" id="userFile-icons" style="display: none">
                                    <div class="progress-bar" role="progressbar" aria-valuenow="60"
                                         aria-valuemin="0" aria-valuemax="100" style="width: 40%;">
                                        <span class="sr-only"><span id="upload-down"></span> 完成</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row" id="msg-input-box" style="padding-top: 1.2rem; display: none">
                                <div class="col-md-4 text-xl-center ">
                                    <h5><img src="/images/classTime.png" alt=""> 用户姓名</h5>
                                    <input class="form-control" id="userName" type="text"/>
                                </div>
                                <div class="col-md-4 text-xl-center ">
                                    <h5><img src="/images/classTime.png" alt=""> 用户类别</h5>
                                    <select class="form-control" id="userType">
                                        <option value="学生">学生</option>
                                        <option value="教师">教师</option>
                                        <option value="家长">家长</option>
                                    </select>
                                </div>
                                <div class="col-md-4 text-xl-center">
                                    <h5><img src="/images/classTime.png" alt=""> 用户学号/工号</h5>
                                    <input class="form-control" id="userNbr" type="text"/>
                                </div>
                                <div class="col-md-4 text-xl-center">
                                    <h5><img src="/images/classTime.png" alt=""> 用户性别</h5>
                                    <select class="form-control" id="userSex" type="text" >
                                        <option value="男">男</option>
                                        <option value="女">女</option>
                                    </select>
                                </div>
                                <div class="col-md-4 text-xl-center">
                                    <h5><img src="/images/classTime.png" alt=""> 用户电话</h5>
                                    <input class="form-control" id="userPhone" type="text"/>
                                </div>
                                <div class="col-md-4 text-xl-center" style="padding-top: 2rem">
                                    <button id="msg-input-btn" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
        </div>
        <div class="tab-pane fade  p-2 show container" id="courseTypeBox" role="tabpanel"
             aria-labelledby="courseTypeBox-tab">
            <div class="row">
                <div class="col-md-12">
                    <div class=" border jumbotron show-box row" style="max-height: 600px;;" id="set-coursetType-box">
                        <div class="col-md-6">
                            <div class="title col-md-12">
                                <h3>课程类别</h3>
                            </div>
                            <hr class="my-4">
                            <table class="table text-center table-set col-md-12">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>课程类别</th>
                                        <th>删除操作</th>
                                    </tr>
                                </thead>
                                <tbody id="show-courseType-list-container"></tbody>
                            </table>
                        </div>
                        <div class="col-md-6">
                            <div class="title col-md-12">
                                <h3>新增课程类型</h3>
                            </div>
                            <hr class="my-4" >
                            <div class="col-md-12 row" style="margin-top: 3rem">
                                <label for="newCourseType">输入新课程类型</label>
                                <div class="col-md-12">
                                    <input id="newCourseType" class="form-control" style="display: inline;width: 50%;">
                                    <button class="btn btn-primary" id="newCourseType-btn">确定</button>
                                </div>
                        </div>
                </div>
            </div>
                </div>
            </div>
        </div>
</div>

</div>
<div class="modal fade" id="courseMsgModel" tabindex="-1" data-backdrop="static" role="dialog"
     aria-labelledby="courseMsgModelLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="courseMsgModelLabel">课程详细信息</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body table-set" style="padding-bottom: 0;">
                <table class="table text-center table-striped  shadow">
                    <tbody id="course-msg-container">
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="checkMsgModel" tabindex="-1" data-backdrop="static" role="dialog"
     aria-labelledby="checkMsgModelLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="checkMsgModelLabel">修改课程信息</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body" style="padding-bottom: 0;">
                <table class="table text-center table-striped  shadow ">
                    <tbody id="check-msg-container">
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary courseMsg-yes">确定</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="checkUserModel" tabindex="-1" data-backdrop="static" role="dialog"
     aria-labelledby="checkMsgModelLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="checkUserModelLabel">修改用户信息</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body" style="padding-bottom: 0;">
                <table class="table text-center table-striped  shadow ">
                    <tbody id="check-user-msg-container">
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" id="user-yes" class="btn btn-primary">确定</button>
            </div>
        </div>
    </div>
</div>
<!--background-color: #4cd137;-->
<script type="text/html" id="courses-show-box-art">
    {{ if data && data.length>0 }}{{each data}}
    <div class="ibox  border shadow courses-show-box">
        <div class="ibox-title border-bottom">
            <h5>{{$value.name}}</h5>
        </div>
        <div class="ibox-content">
            <h1 class="no-margins"><span class="classNumber">{{$value.value}}</span></h1>
        </div>
    </div>
    {{/each}}{{/if}}
</script>
<script type="text/html" id="show-history-box-art">
    {{ if data && data.length>0 }}{{each data}}
    <tr>
        <td>{{$index + 1}}</td>
        <td style="width: 180px">{{$value.COURSE_TIME | formatDateString}}</td>
        <td style="width: 100px">{{$value.COURSE_TYPE_NAME}}</td>
        <td style="width: 100px">{{$value.COURSE_TEACHER_NAME}}</td>
        <td style="width: 100px"><a class="courseDet" href="javascript:;" data-courseid="{{$index}}">点击</a></td>
    </tr>
    {{/each}}{{/if}}
</script>
<script type="text/html" id="show-issue-box-art">
    {{ if data && data.length>0 }}{{each data}}
    <tr>
        <td >{{$index + 1}}</td>
        <td >{{$value.COURSE_TIME | formatDateString}}</td>
        <td >{{$value.COURSE_TYPE_NAME}}</td>
        <td >{{$value.COURSE_TEACHER_NAME}}</td>
        <td >{{$value.COURSE_STATUS | caseStatus }}</td>
        <td >{{if '0' == $value.COURSE_STATUS }}
            <a class="checkBtn" href="javascript:;" data-courseid="{{$index}}">编辑</a>
            {{else}}
            <p>已过期</p>
            {{/if}}
        </td>
    </tr>
    {{/each}}{{/if}}
</script>
<script type="text/html" id="course-msg-art">
    {{ if data}}
    <tr>
        <td class="align-middle">课程ID</td>
        <td class="align-middle"><p></p>{{data.COURSE_ID}}</td>
    </tr>
    <tr>
        <td class="align-middle">课程名</td>
        <td class="align-middle"><p></p>{{data.COURSE_NAME}}</td>
    </tr>
    <tr>
        <td class="align-middle">课程类型</td>
        <td class="align-middle"><p type="text">{{data.COURSE_TYPE_NAME}}</td>
    </tr>
    <tr>
        <td class="align-middle">课程详细内容</td>
        <td class="align-middle"><p>{{data.COURSE_DETAIL}}</td>
    </tr>
    <tr>
        <td class="align-middle">课程老师</td>
        <td class="align-middle"><p>{{data.COURSE_TEACHER_NAME}}</p></td>
    </tr>
    <tr>
        <td class="align-middle">课程时间</td>
        <td class="align-middle"><p>{{data.COURSE_TIME | formatDateString}}</p></td>
    </tr>
    <tr>
        <td class="align-middle">课程状态</td>
        <td class="align-middle"><p>{{data.COURSE_STATUS}}</p></td>
    </tr>
    {{/if}}
</script>
<script type="text/html" id="check-msg-art">
    {{ if courseDetail}}
    <tr>
        <td class="align-middle">课程名</td>
        <td class="align-middle"><input class="form-control" id="course_name" type="text"
                                        value="{{courseDetail.COURSE_NAME}}"/></td>
    </tr>
    <tr>
        <td class="align-middle">课程类型</td>
        <td class="align-middle"><input class="form-control" type="text" id="course_typeName"
                                        value="{{courseDetail.COURSE_TYPE_NAME}}" readonly="readonly"></td>
    </tr>
    <tr>
        <td class="align-middle">课程详细内容</td>
        <td class="align-middle"><input class="form-control" type="text" id="course_detail"
                                        value="{{courseDetail.COURSE_DETAIL}}"></td>
    </tr>
    <tr>
        <td class="align-middle">课程老师</td>
        <td class="align-middle"><input class="form-control" type="text" id="course_teacherName"
                                        value="{{courseDetail.COURSE_TEACHER_NAME}}" readonly="readonly"></td>
    </tr>
    <tr>
        <td class="align-middle">课程时间</td>
        <td class="align-middle"><input class="form-control" type="text" id="course_time"
                                        value="{{courseDetail.COURSE_TIME | formatDateString}}"></td>
    </tr>
    <tr>
        <td colspan='2' style='text-align: center'>
            <p><a href="javascript:;" class="text-decoration-none del-course"
                  data-courseid="{{courseDetail.COURSE_ID}}">取消课程</a>
            </p>
        </td>
    </tr>
    {{/if}}
</script>
<script type="text/html" id="show-stu-list-art">
    {{ if data && data.length>0 }}{{each data}}
    <tr>
        <td >{{$index + 1}}</td>
        <td >{{$value.user_ID}}</td>
        <td >{{$value.user_NBR}}</td>
        <td >{{$value.user_NAME}}</td>
        <td >{{$value.user_SEX}}</td>
        <td >{{$value.user_PHONE}}</td>
        <td >{{$value.update_TIME | formatDateString}}</td>
        <td ><a class="stu-compile" href="javascript:;" data-uindex="{{$index}}">编辑</a></td>
    </tr>
    {{/each}}{{/if}}
</script>
<script type="text/html" id="show-tea-list-art">
    {{ if data && data.length>0 }}{{each data}}
    <tr>
        <td >{{$index + 1}}</td>
        <td >{{$value.user_ID}}</td>
        <td >{{$value.user_NBR}}</td>
        <td >{{$value.user_NAME}}</td>
        <td >{{$value.user_SEX}}</td>
        <td >{{$value.user_PHONE}}</td>
        <td >{{$value.update_TIME | formatDateString}}</td>
        <td ><a class="tea-compile" href="javascript:;" data-uindex="{{$index}}">编辑</a></td>
    </tr>
    {{/each}}{{/if}}
</script>
<script type="text/html" id="check-user-msg-art">
    {{ if data}}
    <tr>
        <td class="align-middle">用户ID</td>
        <td class="align-middle"><p class="form-control" id="user_id" type="text" readonly="readonly" >{{data.user_ID}}</p></td>
    </tr>
    <tr>
        <td class="align-middle">用户NBR</td>
        <td class="align-middle"><p class="form-control" type="text" data-unbr="{{data.user_NBR}}" id="user_nbr" readonly="readonly" >{{data.user_NBR}}</p></td>
    </tr>
    <tr>
        <td class="align-middle">用户名</td>
        <td class="align-middle"><input class="form-control" type="text" id="user_name"
                                        value="{{data.user_NAME}}" /></td>
    </tr>
    <tr>
        <td class="align-middle">性别</td>
        <td class="align-middle"><select class="form-control" type="text" id="user_sex"
                                         value="{{data.user_SEX}}" >
            <option value="男">男</option>
            <option value="女">女</option>
        </select></td>
    </tr>
    <tr>
        <td class="align-middle">电话</td>
        <td class="align-middle"><input class="form-control" type="text" id="user_phone"
                                        value="{{data.user_PHONE}}" /></td>
    </tr>
    <tr>
        <td class="align-middle">密码</td>
        <td class="align-middle"><input class="form-control" type="password" id="user_pass"
                                        value="{{data.user_PASS}}" style="display: inherit;width: 90%;" />
            <span class="seePass">
                <svg class="bi bi-eye-fill " id="cansee" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
            <path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
            <path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z" clip-rule="evenodd"/>
            </svg>
            <svg class="bi bi-eye-slash-fill " id="nosee" width="1em" height="1em" style="display: none" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                <path d="M10.79 12.912l-1.614-1.615a3.5 3.5 0 0 1-4.474-4.474l-2.06-2.06C.938 6.278 0 8 0 8s3 5.5 8 5.5a7.029 7.029 0 0 0 2.79-.588zM5.21 3.088A7.028 7.028 0 0 1 8 2.5c5 0 8 5.5 8 5.5s-.939 1.721-2.641 3.238l-2.062-2.062a3.5 3.5 0 0 0-4.474-4.474L5.21 3.089z"/>
                <path d="M5.525 7.646a2.5 2.5 0 0 0 2.829 2.829l-2.83-2.829zm4.95.708l-2.829-2.83a2.5 2.5 0 0 1 2.829 2.829z"/>
                <path fill-rule="evenodd" d="M13.646 14.354l-12-12 .708-.708 12 12-.708.708z" clip-rule="evenodd"/>
            </svg>
           </span>
        </td>
    </tr>
    {{/if}}
</script>
<script type="text/html" id="show-courseType-list-art">
    {{ if data && data.length>0 }}{{each data}}
    <tr>
        <td>{{$value.COURSE_TYPE_ID}}</td>
        <td>{{$value.COURSE_TYPE_NAME}}</td>
        <td><a class="delCourseType" data-ctname="{{$value.COURSE_TYPE_NAME}}" href="javascript:;">删除</a></td>
    </tr>
    {{/each}}{{/if}}
</script>
<script type="text/html" id="show-reset-list-art">
    {{ if data && data.length>0 }}{{each data}}
    <tr>
        <td>{{$index + 1}}</td>
        <td>{{$value.REQUEST_ID}}</td>
        <td>{{$value.REQUEST_USER_NBR}}</td>
        <td>{{$value.REQUEST_USER_NAME}}</td>
        <td>{{$value.REQUEST_USER_IPHONE}}</td>
        <td>{{$value.REQUEST_DETAIL}}</td>
        <td>{{$value.REQUEST_STATUS | caseReStatus}}</td>
        <td>
            {{ if '0' == $value.REQUEST_STATUS }}
            <p><a class="consent" data-rid="{{$value.REQUEST_ID}}" href="javascript:;">同意</a></p>
            <p><a class="noconsent" data-rid="{{$value.REQUEST_ID}}" href="javascript:;">不同意</a></p>
            {{else}}
            <p>已处理</p>
            {{/if}}
        </td>
    </tr>
    {{/each}}{{/if}}
</script>
<script src="/js/jquery-3.1.1.min.js"></script>
<script src="/js/bootstrap/bootstrap-v4.3.1.min.js"></script>
<script src="/js/echarts/echarts.min.js"></script>
<script src="/js/bootstrap/datepicker/bootstrap-datetimepicker.min.js"></script>
<script src="/js/bootstrap/datepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/js/app.js"></script>
<script type="text/javascript">
    template.helper('formatDateString', function (value) {
        return new Date(value).format('yyyy-MM-dd hh:mm');
    });
    template.helper('caseStatus', function (value) {
        switch (value) {
            case 0:
                return "可预约";
            case 1:
                return "过期";
            case 2:
                return "已取消";
            default:
                return "异常";
        }
    });
    template.helper('caseReStatus', function (value) {
        switch (value) {
            case 0:
                return "申请中";
            case 1:
                return "已通过";
            case 2:
                return "已拒绝";
            default:
                return "异常";
        }
    });
    var admin = (function () {
        var _ifCheck = false;
        var bindEvents = function () {
            App.loader();
            admin.getAdminMsg()
            .then(function(){App.removeLoader();return this;});
            admin.el('#update').off('click').on('click',function(){
               admin.getMsgPast();
            });
        };
        return {
            data: {},
            el: function (expr) {
                return $(expr ? expr : 'body');
            },
            init: function () {
                bindEvents();
                return;
            },
            show: function () {
                admin.el().show();
                return this;
            },
            hide: function () {
                admin.el().hide();
                return this;
            },
            varMatChart: function (typeData,courseData) {
                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById('show-data-content'));
                var myChartoption = {
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: typeData
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series:courseData
                };
                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(myChartoption);
            },
            varMyPieChart: function (data) {
                var myPieChart = echarts.init(document.getElementById('show-pie-chart'));
                option = {
                    series: [{
                        name: '课程比例',
                        type: 'pie',
                        radius: '55%',
                        // roseType: 'angle',
                        data: data
                    }]
                };
                myPieChart.setOption(option);
            },
            uploadFile: function () {
                var $file = document.getElementById("#userFile");
                var fileVal = admin.el("#userFile").val();//用户文件内容(文件)
                // 判断文件是否为空
                if (fileVal == "") {
                    App.alert("请选择上传的目标文件! ", "", 3, function () {
                        return;
                    });
                    return;
                }
                //判断文件类型,我这里根据业务需求判断的是Excel文件
                var fileName1 = fileVal.substring(fileVal.lastIndexOf(".") + 1).toLowerCase();
                if (fileName1 != "xls" && fileName1 != "xlsx") {
                    App.alert("请选择Execl文件!", "", 3, function () {
                        return;
                    });
                    return;
                }
                //判断文件大小
                var size1 = $("#userFile")[0].files[0].size;
                if (size1 > 104857600) {
                    alert("上传文件不能大于100M!");
                    return;
                }
                var formData = new FormData();//这里需要实例化一个FormData来进行文件上传
                formData.append("file", $("#userFile")[0].files[0]);
                App.loader();
                $.ajax({
                    type: "post",
                    url: "/dtr/user-file/upload",
                    data: formData,
                    processData: false,
                    contentType: false,
                    success: function (data) {
                        if (!App.checker(data)) {
                            return;
                        } else {
                            App.removeLoader();
                            var done = data.ExcelStatus.done;
                            var nodone = data.ExcelStatus.nodone;
                            var all = done + nodone;
                            App.alert("提交成功",'新注册' + all + '人,成功'+ done +',失败' + nodone);
                            return;
                        }
                    }
                });
            },
            selectBoxShow: function () {
                admin.el("#input-select-box").show();
                admin.el("#back-select-box").hide();
                admin.el("#upload-box").hide();
                admin.el("#msg-input-box").hide();
            },
            selectBoxHide: function () {
                admin.el("#input-select-box").hide();
                admin.el("#back-select-box").show();
            },
            uploadBoxShow: function () {
                admin.el("#upload-box").show();
                admin.el("#msg-input-box").hide();
            },
            magInputBoxShow: function () {
                admin.el("#upload-box").hide();
                admin.el("#msg-input-box").show();
            },
            panelClick:function () {
                admin.el("#back-select-box").off("click").on("click", function () {
                    admin.selectBoxShow();
                });
                admin.el("#upload-btn").off("click").on("click", function () {
                    admin.uploadFile();
                });
                admin.el("#input-once").off("click").on("click", function () {
                    admin.checkPass(function () {
                        admin.selectBoxHide();
                        admin.magInputBoxShow();
                    });
                });
                admin.el("#input-batch").off("click").on("click", function () {
                    admin.checkPass(function () {
                        admin.selectBoxHide();
                        admin.uploadBoxShow();
                    });
                });
                admin.el("#msg-input-btn").off("click").on("click", function () {
                    var userName = admin.el('#userName').val();
                    var userType = admin.el('#userType').val();
                    var userNbr = admin.el('#userNbr').val();
                    var userSex = admin.el('#userSex').val();
                    var userPhone = admin.el('#userPhone').val();
                    $.loadJSON('/dtr/admin/addUser', {
                        userName: userName,
                        userType: userType,
                        userNbr: userNbr,
                        userSex: userSex,
                        userPhone: userPhone
                    }).done(function (data) {
                        if (!App.checker(data)) {
                            return;
                        } else {
                            App.alert("提交成功", '', 1, function () {
                                admin.inputClear();
                            });
                            return;
                        }
                    });
                });
                admin.el("#admin-loginOut").off("click").on("click", function () {
                    var adminID = admin.el(".adminName").data("adminID");
                    $.loadJSON('/dtr/admin/adminOut', {
                        adminID:adminID
                    }).done(function (data) {
                        if (!App.checker(data)) {
                            return;
                        } else {
                            App.alert("退出成功", '', 1, function () {App.goAdminLoginBySelf()});
                            return;
                        }
                    });
                });
                admin.el(".courseDet").off("click").on("click", function () {
                    var courseid = $(this).data("courseid");
                    var dataList = admin.el("#show-history-box-container").data("courseList");
                    var dataDet = dataList[courseid];
                    admin.paddingData(dataDet,"course-msg-art","#course-msg-container").then(function(){admin.el("#courseMsgModel").modal("show")});
                });
                admin.el(".checkBtn").off("click").on("click", function () {
                    var courseid = $(this).data("courseid");
                    var dataList = admin.el("#check-msg-container").data("courseList");
                    var dataDet = dataList[courseid];
                    admin.paddingCourseCheckShowModel(dataDet).then(function(){admin.el("#checkMsgModel").modal("show")});
                    admin.panelClick();
                });
                admin.el('.courseMsg-yes').off('click').on('click', function () {
                    var courseID = admin.el('.del-course').data("courseid");
                    var course_name = admin.el("#course_name").val();
                    var course_detail = admin.el("#course_detail").val();
                    var course_time = admin.el("#course_time").val() + ':00';
                    $.loadJSON('/dtr/issue/updateCourse', {
                        courseID: courseID,
                        courseName: course_name,
                        courseDetail: course_detail,
                        courseTime: course_time
                    }).done(function (data) {
                        if (!App.checker(data)) {
                            return;
                        } else {
                            App.alert("修改成功", "", 1, function () {
                                admin.el("#checkMsgModel").modal("hide");
                                admin.getCourseList()
                            });
                        }
                    });
                });
                admin.el('.del-course').off('click').on('click', function () {
                    var courseID = $(this).data('courseid');
                    App.selectAlert("操作提示", "确定取消吗？", 3, function () {
                        $.loadJSON('/dtr/issue/cancelCourse', {
                            courseID: courseID
                        }).done(function (data) {
                            if (!App.checker(data)) {
                                return;
                            } else {
                                App.alert("取消成功", "", 1, function () {
                                    admin.getCourseList()
                                });
                            }
                        });
                    });
                });
                admin.el('.stu-compile').off('click').on('click', function () {
                    var index = $(this).data('uindex');
                    var list = admin.el("#show-stu-list-container").data("data");
                    var stuMsg = list[index];
                    admin.checkPass(function () {
                        admin.paddingData(stuMsg,"check-user-msg-art","#check-user-msg-container")
                            .then(function () {admin.el("#checkUserModel").modal("show");return this;})
                            .then(function () {admin.panelClick();return this;});
                        admin.panelClick();
                    });
                });
                admin.el('.tea-compile').off('click').on('click', function () {
                    var index = $(this).data('uindex');
                    var list = admin.el("#show-tea-list-container").data("data");
                    var teaMsg = list[index];
                    admin.checkPass(function () {
                        admin.paddingData(teaMsg,"check-user-msg-art","#check-user-msg-container")
                            .then(function () {admin.el("#checkUserModel").modal("show");return this;})
                            .then(function () {admin.panelClick();return this;});
                    });
                });
                admin.el('.seePass').off('click').on('click', function () {
                    var can =  admin.el("#cansee").css('display');
                    var no =  admin.el("#nosee").css('display');
                    if (admin.el("#cansee").css('display') != 'none'){
                        admin.el("#cansee").css('display','none');
                        admin.el("#nosee").css('display','inline')
                        $(this).prev().attr("type", "text");
                    }else {
                        admin.el("#nosee").css('display','none');
                        admin.el("#cansee").css('display','inline');
                        $(this).prev().attr("type", "password");
                    }
                });
                admin.el('#user-yes').off('click').on('click', function () {
                    var userName = admin.el('#user_name').val();
                    var userNbr = admin.el("#user_nbr").data("unbr");
                    var userSex = admin.el("#user_sex").val();
                    var userPass = admin.el("#user_pass").val();
                    var userPhone = admin.el("#user_phone").val();
                    $.loadJSON('/dtr/admin/upUserDet', {
                        userName: userName,
                        userNbr: userNbr,
                        userSex: userSex,
                        userPass: userPass,
                        userPhone:userPhone
                    }).done(function (data) {
                        if (!App.checker(data)) {
                            return;
                        } else {
                            App.alert("修改成功", "", 1, function () {
                                admin.el("#checkMsgModel").modal("hide");
                                admin.getUserList();
                            });
                        }
                    });
                });
                admin.el('.delCourseType').off('click').on('click', function () {
                    var ctName = $(this).data("ctname");
                        admin.checkPass(function () {
                            App.selectAlert("操作提示", "确定删除吗？", 3, function () {
                                $.loadJSON('/dtr/admin/delCType', {
                                    ctName: ctName
                                }).done(function (data) {
                                    if (!App.checker(data)) {
                                        return;
                                    } else {
                                        App.alert("删除成功", "", 1, function () {
                                            admin.getMsgPast();
                                        });
                                    }
                                });
                            });
                        });
                });
                admin.el('#newCourseType-btn').off('click').on('click', function () {
                    var ctName = admin.el('#newCourseType').val();
                        admin.checkPass(function () {
                            App.selectAlert("操作提示", "确定提交吗？", 3, function () {
                                $.loadJSON('/dtr/admin/addCType', {
                                    ctName: ctName
                                }).done(function (data) {
                                    if (!App.checker(data)) {
                                        return;
                                    } else {
                                        App.alert("新增成功", "", 1, function () {
                                            admin.getMsgPast();
                                        });
                                    }
                                });
                            });
                        });
                });
                admin.el('.consent').off('click').on('click', function () {
                    var id = $(this).data('rid');
                        admin.checkPass(function () {
                            App.selectAlert("操作提示", "确定同意吗？", 3, function () {
                                $.loadJSON('/dtr/admin/resetPass', {
                                    id: id,
                                    status: 1
                                }).done(function (data) {
                                    if (!App.checker(data)) {
                                        return;
                                    } else {
                                        App.alert("操作成功", "", 1, function () {
                                            admin.getMsgPast();
                                        });
                                    }
                                });
                            });
                        });
                });
                admin.el('.noconsent').off('click').on('click', function () {
                    var id = $(this).data('rid');
                        admin.checkPass(function () {
                            App.selectAlert("操作提示", "确定不同意吗？", 3, function () {
                                $.loadJSON('/dtr/admin/resetPass', {
                                    id: id,
                                    status: 2
                                }).done(function (data) {
                                    if (!App.checker(data)) {
                                        return;
                                    } else {
                                        App.alert("操作成功", "", 1, function () {
                                            admin.getMsgPast();
                                        });
                                    }
                                });
                            });
                        });
                });
            },
            getMsgPast:function(){
                $.loadJSON('/dtr/admin/getHistory').done(function (data) {
                    if (!App.checker(data)) {
                        return;
                    } else {
                        var dataPie = data.pastWeek;
                        var typeData = data.typeList;
                        var allTypeList = data.allTypeList;
                        var courseData = data.pastMonth.courseList;
                        var courseList = data.pastMonthCourseList;
                        var resetList = data.requestList;
                        admin.el("#show-history-box-container").data("courseList",courseList);
                        admin.paddingData(courseList,"show-history-box-art","#show-history-box-container");
                        admin.varMyPieChart(dataPie);
                        admin.varMatChart(typeData,courseData);
                        admin.paddingData(dataPie,"courses-show-box-art","#courses-show-box-container")
                            .then(function (){admin.paddingData(resetList,"show-reset-list-art","#show-reset-list-container");return this;})
                            .then(function(){admin.paddingData(allTypeList,"show-courseType-list-art","#show-courseType-list-container");return this;})
                            .then(function(){admin.panelClick();return this;})
                            .then(function(){admin.getCourseList();;return this;})
                            .then(function(){admin.getUserList();return this;})
                            .then(function(){admin.panelClick();return this;})
                            .then(function () {App.randomBackgroundColor("courses-show-box");return this});
                        return;
                    }
                });
            },
            getCourseList:function(){
                $.loadJSON('/dtr/admin/getCouList').done(function (data) {
                    if (!App.checker(data)) {
                        return;
                    } else {
                        var dataList = data.oneMonth;
                        admin.el("#check-msg-container").data("courseList",dataList);
                        admin.paddingData(dataList,"show-issue-box-art","#show-issue-box-container").then(function(){admin.panelClick();return this;});
                        return;
                    }
                });
            },
            getUserList:function(){
                $.loadJSON('/dtr/admin/getAllUser').done(function (data) {
                    if (!App.checker(data)) {
                        return;
                    } else {
                        var stuList = data.stuList;
                        var teaList = data.teaList;
                        admin.el("#show-stu-list-container").data("data",stuList);
                        admin.el("#show-tea-list-container").data("data",teaList);
                        admin.paddingData(stuList,"show-stu-list-art","#show-stu-list-container")
                            .then(function(){admin.paddingData(teaList,"show-tea-list-art","#show-tea-list-container");return this})
                            .then(function(){admin.panelClick();return this;});
                            return;
                    }
                });
            },
            paddingCourseCheckShowModel:function (data) {
                return $.Deferred(function (defer) {
                    admin.el("#check-msg-container").html(template('check-msg-art', {courseDetail: data}));
                    App.setInputBoxForTime('#course_time');
                    defer.resolve();
                }).promise();
            },
            paddingData:function(data,art,container){
                return $.Deferred(function (defer) {
                    admin.el(container).html(template(art, {data: data}));
                    defer.resolve();
                }).promise();
            },
            getAdminMsg:function () {
                return $.Deferred(function (defer) {
                    $.loadJSON('/dtr/admin/getAdmin').done(function (data) {
                        if (!App.checker(data)) {
                            App.alert("管理员未登录！","",2,function(){
                               App.goAdminLoginBySelf();
                            });
                        } else {
                            var adminName = data.admin.name;
                            var adminID = data.admin.id;
                            admin.el(".adminName").html(adminName);
                            admin.el(".adminName").data("adminID",adminID);
                            admin.el(".adminName").data("adminPass",data.admin.pass);
                            admin.getMsgPast();
                        }
                    });
                    defer.resolve();
                }).promise();
            },
            checkPass:function(callback){
                if (!_ifCheck){
                    App.inputAlert('password',"鉴权","请输入管理员密码",function(value){
                        var pass = admin.el(".adminName").data("adminPass");
                        if (pass == value){
                            _ifCheck = true;
                            if ($.isFunction(callback)) {
                                callback();
                                return;
                            }
                        }else {
                            App.alert('错误','鉴权错误',2);
                        }
                    });
                }else {
                    if ($.isFunction(callback)) {
                        callback();
                        return;
                    }
                }
            },
            getCourseType:function(callback){
                    $.loadJSON('/dtr/admin/getHistory').done(function (data) {
                        if (!App.checker(data)) {
                            return;
                        } else {
                            var dataPie = data.pastWeek;
                            var typeData = data.typeList;
                            var allTypeList = data.allTypeList;
                            var courseData = data.pastMonth.courseList;
                            var courseList = data.pastMonthCourseList;
                            admin.el("#show-history-box-container").data("courseList",courseList);
                            admin.paddingData(courseList,"show-history-box-art","#show-history-box-container");
                            admin.varMyPieChart(dataPie);
                            admin.varMatChart(typeData,courseData);
                            admin.paddingData(dataPie,"courses-show-box-art","#courses-show-box-container")
                                .then(function () {admin.panelClick();return this})
                                .then(function () {App.randomBackgroundColor("courses-show-box");return this});
                            return;
                        }
                    });
            },
            inputClear:function(){
                admin.el('#userName').val('');
                var userType = admin.el('#userType').val("选择");
                var userNbr = admin.el('#userNbr').val('');
                var userSex = admin.el('#userSex').val('选择');
                var userPhone = admin.el('#userPhone').val('');
            }
        }
    })();
    $(function () {
        admin.init();
    });
</script>
</body>

</html>